package com.qf.controller;

import com.qf.pojo.BaseResp;
import com.qf.pojo.TicketRep;
import com.qf.pojo.UpdateRes;
import com.qf.service.ITicketService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;

/**
 * @Author
 * @Description
 * @Date 2022/3/28
 */
@RestController
@RequestMapping("/train")
public class TicketController {
    @Autowired
    ITicketService ticketService;
    //条件分页
    @RequestMapping("/findAll")
    public BaseResp findAll(@RequestBody TicketRep tickerRep){

        return ticketService.findAll(tickerRep);

    }
    @RequestMapping("/update")
    //修改  id：支付成功后的订单id
    public BaseResp update(@RequestBody UpdateRes updataRes){
        return ticketService.update(updataRes);
    }
    //id查询
    @RequestMapping("/findById")
    public BaseResp findById(@RequestParam("id") Integer id){
        return ticketService.findById(id);
    }


    @RequestMapping("/trip")
    public BaseResp trip(){

        return new BaseResp(1,"查询成功","http://r9yl00k4v.hn-bkt.clouddn.com/2.jpg",null);

    }
    @RequestMapping("/service")
    public BaseResp service(){

        return new BaseResp(1,"查询成功","http://r9yl00k4v.hn-bkt.clouddn.com/2.jpg",null);

    }

    @RequestMapping("/app")
    public BaseResp app(){
        Map map=new HashMap<>();
        map.put("name","酒店");
        map.put("name","铁路e卡通");
        map.put("name","铁路商城");
        map.put("name","中铁手机卡");
        map.put("name","出行保险");
        return new BaseResp(1,"查询成功",map,null);
    }
}
